package com.zpark.cloud.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @PackageName: com.zpark.cloud.controller
 * @ClassName: ConsumerController
 * @Description:
 * @author: RZS
 * @date: 2023/6/19  11:46
 */
@RestController
@RequestMapping("/eureka_client_consumer")
public class ConsumerController {

    @Autowired
    private RestTemplate restTemplate;
    @Value("${server-url.path}")
    private String url;

    @GetMapping("/demo")
    public String demo(){
        // 服务远程调用
        return restTemplate.getForObject(url + "/eureka_client_provider/test", String.class);
    }
}
